<?php

include_once ("mysql_conn.php");
$id = $_POST['id'];
$name = $_POST['name'];
$option = $_POST['option'];
$say = $_POST['huayu'];
$mete = $_POST['cailiao'];
$remark = $_POST['beizhu'];
$price = $_POST['price'];
$number = $_POST['kucun'];
$protype = $_POST['protype'];
$type= $_POST['type'];
$conn = new mysql_conn();
if ($option == 1) {//更新
    $sql = "update flower set name = '" . $name . "',say ='" . $say . "',meta='" . $mete . "',number = '" . $number . "',price='" . $price . "',remark = '" . $remark . "' where id = " . $id;
    $conn->add_upadate($sql);
echo "<script>alert('修改成功!');window.location='homeAdminItems.php';</script>";
}else if ($option == 2){//新增
    $sql = "insert into   flower(name,say,meta,number,price,remark,typeid,protypeid) values('".($name==NULL?" " : $name)."','".($say==NULL?" " : $say)."','".($mete==NULL?" " : $mete)."','".($number==NULL?" " : $number)."','".($price==NULL?" " : $price)."','".($remark==NULL?" " : $remark)."',' ".($type==NULL?" " : $type)."','".($protype==NULL?" " : $protype)."')";
    $conn->add_upadate($sql);
//    echo $sql;
    echo "<script>alert('添加成功!');window.location='homeAdminItems.php';</script>";
}


?>